package com.hkbigdata.source;

import com.hkbigdata.bean.WaterSensor;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;
import java.util.List;

/**
 * @author liuanbo
 * @creat 2024-04-12-9:39
 * @see 2194550857@qq.com
 */
public class Flink01_Source_Collection {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment environment = StreamExecutionEnvironment.getExecutionEnvironment();

        environment.setParallelism(1);

        List<WaterSensor> waterSensors = Arrays.asList(
                new WaterSensor("ws_001", 1577844001L, 78.0),
                new WaterSensor("ws_002", 1577844010L, 78.0),
                new WaterSensor("ws_003", 1577844012L, 88.0)
        );

        environment.fromCollection(waterSensors).print();

        environment.execute();
    }
}
